import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'



import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios)
axios.defaults.baseURL = 'http://api.zhanggm.com/';

axios.interceptors.request.use(config=>{
  console.log(config);
  let token = localStorage.getItem("token") || '';
  config.headers['token'] = token;
  return config;
},err=>{
  return Promise.reject(err);
})

//http response 拦截器
axios.interceptors.response.use(response=>{
  console.log("responseData",response.data.data);
  return response;
},err=>{
  return Promise.reject(err.response.status);
});


Vue.config.productionTip = false
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
